<template>
	<template v-for="item of list" :key="item.id">
		<el-sub-menu :index="item.id" v-if="item.children">
			<template #title>
				<my-icon :icon="item?.meta?.icon"></my-icon>
				<span>{{ item.meta.title }}</span>
			</template>
			<menu-list :list="item.children"></menu-list>
			<!--递归调用-->
		</el-sub-menu>
		<el-menu-item :index="item.path ? item.path : item.id" v-else-if="item.menuType !== 'M'">
			<my-icon :icon="item?.meta?.icon"></my-icon>
			<span>{{ item.meta.title }}</span>
		</el-menu-item>
	</template>
</template>

<script setup name="MenuList">
defineProps({
	list: {
		type: Array,
		required: true
	}
});
</script>
